<template>
  <ul class="todo-list">
  
    <li v-for="item in list" :key="item.id" :class="{completed: item.isDone}">
      <div class="view">
        <input v-model="item.isDone" class="toggle" type="checkbox" />
        <label>{{ item.name }}</label>
        <button @click="$emit('del', item.id)" class="destroy" ></button>
      </div>
    </li>
  </ul>
</template>

<script>
export default {
  props: {
    // 代表要一个list，限制必须要传，并且只能传数组
    list: {
      required: true,
      type: Array
    }
  }
}
</script>